class code2_2 {
    //方法二：
    public List<List<Integer>> ret;
    public List<Integer> path;
    public List<List<Integer>> subsets(int[] nums) {
        ret = new ArrayList<>();
        path = new ArrayList<>();
        dfs(nums,0);
        return ret;
    }
    public void dfs(int[] nums,int pos) {//pos相当于层
        ret.add(new ArrayList<>(path));
        for(int i=pos;i<nums.length;i++) {
            path.add(nums[i]);
            dfs(nums,i+1);
            path.remove(path.size()-1);
        }

    }
}